<?php
/**
 * The Header for our theme.
 *
 *
 * @package WordPress
 * @subpackage urbanmeandering
 * @since urbanmeandering 1.0
 */
?>
<!DOCTYPE html>
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<meta name="viewport" content="width=device-width" />
	<title><?php um_title_tag(); ?></title>
	
	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
	
	<!--[if lt IE 9]>
	<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
	<![endif]-->
	
	<?php	wp_head(); ?>
</head>
<body <?php body_class(); ?>>
    
<div id="page" class="hfeed">
	<header id="branding" role="banner">
		<nav id="access" role="navigation">
			<h3 class="assistive-text"><?php _e( 'Main menu', 'urbanmeandering' ); ?></h3>
			<div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'urbanmeandering' ); ?>"><?php _e( 'Skip to primary content', 'urbanmeandering' ); ?></a></div>
			<div class="skip-link"><a class="assistive-text" href="#sidebar" title="<?php esc_attr_e( 'Skip to secondary content', 'urbanmeandering' ); ?>"><?php _e( 'Skip to secondary content', 'urbanmeandering' ); ?></a></div>
			<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
			<?php echo get_search_form(); ?>
		</nav>
		<hgroup>
			<h1 id="site-title">
				<span>
					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
						<img src="<?php echo IMG , 'urban-meandering.png'; ?>" alt="<?php bloginfo( 'name' ); ?> - <?php bloginfo( 'description' ); ?>" />
					</a>
				</span>
			</h1>
		</hgroup>
		<?php 
		if ( is_home() )
		{ 
			um_carousel();
		}
		else
		{
			global $post, $wp_query;
			$banner = '';
			$banner_id = '';
			$banner_title = '';
			
			if( is_page() )
			{
				$banner_id = get_post_thumbnail_id( $post->ID );
				$banner_title = $post->post_title;
			}
			elseif( is_post_type_archive() || is_single() )
			{
				if( $post )
				{
					$post_type = $post->post_type;
					$banner_title = $post->post_title;
				}
				elseif( is_post_type_archive() )
				{
					$post_type = isset( $wp_query->query['post_type'] ) ? $wp_query->query['post_type'] : '';
					$banner_title = post_type_archive_title( '', false );
				}
				
				if( $post_type )
				{
					$banner_id = get_option( 'um-' . $post_type . '-options' );
					$banner_id = isset( $banner_id['header-image-id'] ) && $banner_id['header-image-id'] ? $banner_id['header-image-id'] : '';
				}
				else
				{
					$banner_id = '';
					$banner_title = 'Urban Meandering';
				}
			}
						
			if( $banner_id )
			{
				$banner = wp_get_attachment_image_src( $banner_id, '1000x155' );
				if( $banner && isset( $banner[0] ) )
				{
					$banner = $banner[0];
				}
				
				if( ! $banner_title )
				{
					$banner_title = 'Urban Meandering';
				}
			}
			
			$banner = $banner ? $banner : IMG . 'banner-b.png';
			
			?>
				<img id="banner" src="<?php echo $banner; ?>" alt="<?php echo $banner_title; ?>" />
			<?php
		}
		?>
	</header>
	
	